package com.example.biketask.dao;

import com.example.biketask.pojo.ClickOperation;
import com.example.biketask.pojo.dto.ClickTimes;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;

import java.util.List;

@Mapper
public interface Opt1Mapper {

    @Results(id = "Bt02Map", value = {
            @Result(property = "optId", column = "opt_id", jdbcType = JdbcType.INTEGER),
            @Result(property = "stationId", column = "station_id", jdbcType = JdbcType.VARCHAR),
            @Result(property = "stationName", column = "station_name", jdbcType = JdbcType.VARCHAR),
    })

    /*
    添加bt_02表
     */
    @Insert("insert into bt_02(opt_id,station_id,station_name) values(#{optId},#{stationId},#{stationName})")
    int insert_bt_02(ClickOperation clickOperation);

    /*
    更新
     */

    int update_bt_02();


    /*
    点击次数查询
     */
    @Select("select station_name as station,count(*) as count from bt_02 GROUP BY station_name")
    List<ClickTimes> select_all_times();


}
